package com.ls.uav_backend.config;

import com.alibaba.dashscope.app.ApplicationParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ApplicationParamConfig {

    @Value("${DashScope.app-id}")
    private String appId;

    @Value("${DashScope.api-key}")
    private String apiKey;

    @Bean
    public ApplicationParam basicApplicationParam() {
        return ApplicationParam.builder()
                .apiKey(apiKey)
                .appId(appId)
                .hasThoughts(true)
                .enableThinking(true)
                .incrementalOutput(true)
                .build();
    }

    /**
     * 提供一个参数构建器的Bean（方便在使用时动态修改配置）
     */
    @Bean
    public ApplicationParam.ApplicationParamBuilder<?, ?> applicationParamBuilder() {
        return ApplicationParam.builder()
                .apiKey(apiKey)
                .appId(appId)
                .hasThoughts(true)
                .enableThinking(true)
                .incrementalOutput(true);
    }
}
